	<?php
	// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

		global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;

?>

		

<br /><br />
<div align="center">
<?php


//define the path as relative
$dir = "../mambots/";

//using the opendir function
$dir_handle = @opendir($dir) or die("Unable to open $dir");


  echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" width=\"85%\" align='center'>";
  echo "<tr><th class=\"data-container\" colspan=\"5\">Site Mambots</th></tr>";
  echo "<tr><td class=\"right-col\"> &nbsp;<b>Mambot Name</b></td>";
  echo "<td class=\"right-col\"> &nbsp;<b>Version</b></td>";
  echo "<td class=\"right-col\"> &nbsp;<b>Author</b></td>";
  echo "<td class=\"right-col\"> &nbsp;<b>Author Site<b/></td>";
  echo "<td class=\"right-col\"> &nbsp;<b>Type<b/></td></tr>";
  echo "<tr><td colspan=\"5\" style=\"height: 10px;\"></td></tr>";


while ($file = readdir($dir_handle)) {

  if($file!="." && $file!=".." && $file!="index.html") {
    $newDir = $dir.''.$file;
    $dir1 = opendir($newDir);

     while ($f = readdir($dir1)) {

      if (eregi("\.xml",$f)){ #if filename matches .xml in the name

        $content = file_get_contents($newDir.'/'.$f);

        if (preg_match('#install(.*)#', $content, $isInstallFile)) {

      echo "<tr><td class=\"vflist\" width=\"25%\" style=\"border-left: 1px solid #C0C0C0; border-top: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0;\">&nbsp;<b>";
        if (preg_match('#<name>(.*)</name>#', $content, $name)) {

          if (preg_match('#<author>(.*)</author>#', $content, $author)) {

            if ($author[1] == "Mambo Foundation") {
              echo "<font color=\"green\">". $name[1] ."</font>";
            } else {
              echo "<font color=\"blue\">". $name[1] ."</font>";
            }

          }
        }
      echo "</td>";

      echo "<td class=\"vflist\" width=\"12%\" style=\"color: navy; border-top: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0;\">&nbsp;v <b>";
        if (preg_match('#<version>(.*)</version>#', $content, $version)) {
		  echo $version[1];
		}
	  echo "</b></td>";

      echo "<td class=\"vflist\" width=\"26%\" style=\"border-left: 1px solid #C0C0C0; border-top: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0;\">&nbsp;";
        if (preg_match('#<author>(.*)</author>#', $content, $author)) {
          echo $author[1];
        }
      echo "</td>";
	  
      echo "<td class=\"vflist\" width=\"27%\" style=\" border-top: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0;\">&nbsp;";
        if (preg_match('#<authorUrl>(.*)</authorUrl>#', $content, $authorUrl)) {
          echo "<a href=\"http://". $authorUrl[1] ."\" target=\"_new\">". $authorUrl[1] ."</a>";
        }
      echo "</td>";

      echo "<td class=\"vflist\" width=\"10%\" style=\"border-top: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0;\">&nbsp;";
      if (preg_match('#<author>(.*)</author>#', $content, $author)) {

        if ($author[1] == "Mambo Foundation") {
          echo "<font color=\"green\">Core</font>";
        } else {
          echo "<font color=\"blue\">3rd Party</font>";
        }
      }
    echo "</td></tr>";

    echo "<tr><td colspan=\"5\" class=\"ext_desc\" style=\"background-color: #F1F1F1; border-bottom: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-left: 1px solid #C0C0C0;\">&nbsp;";
      if (preg_match('#<description>(.*)</description>#', $content, $description)) {
		echo strip_tags(substr($description[1], 0, 200));
		echo "...";
      }
    echo "</td></tr>";
    echo "<tr><td colspan=\"5\" style=\"height: 10px;\">&nbsp;</td></tr>";

      }
    }
  }
}
}
  echo "</table>";
  echo "<div class=\"ext_desc\">Done Processing Site Mambots</div>";
  //closing the directory
  closedir($dir_handle);
?>


</div>
<br /><br />

<?php
		$tabs->endTab();
		$tabs->endPane();
?>		